package com.yamanyar.weebill.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yamanyar.weebill.dao.ProjectDAO;
import com.yamanyar.weebill.domain.Project;
import com.yamanyar.weebill.service.ProjectService;

/**
 * Implementation of <code>ProjectService</code> interface. Created in Jun 28,
 * 2008.
 * 
 * @see ProjectService
 * @author Kaan Yamanyar
 */
@Service
public class ProjectServiceImpl implements ProjectService {

	private ProjectDAO projectDAO;

	@Autowired
	public ProjectServiceImpl(ProjectDAO projectDAO) {
		this.projectDAO = projectDAO;
	}

	public void createNew(Project project) {
		projectDAO.persist(project);
	}

	public List<Project> findAll() {
		return projectDAO.loadAll();
	}

	public List<Project> findByName(String name) {
		return projectDAO.findByName(name);
	}

	public Project getProjectWithID(Long id) {
		return projectDAO.loadById(id);
	}
}
